package com.hst.capacity.infra.convertor;

import com.hst.capacity.domain.model.entity.franchisee.AgentEntity;
import com.hst.capacity.domain.model.entity.franchisee.FranchiseeEntity;
import com.hst.capacity.domain.model.entity.franchisee.FranchiseeUserEntity;
import com.hst.capacity.domain.model.entity.franchisee.commision.FranchiseeCommisionEntity;
import com.hst.capacity.domain.model.entity.setting.commision.CommisionEntity;
import com.hst.capacity.domain.model.request.franchisee.FranchiseeSaveParam;
import com.hst.capacity.domain.model.request.franchisee.FranchiseeUserParam;
import com.hst.capacity.domain.model.request.franchisee.commision.FranchiseeCommisionSaveParam;
import com.hst.capacity.domain.model.response.LabelValueVO;
import com.hst.capacity.domain.model.response.franchisee.CommisionSelectVO;
import com.hst.capacity.domain.model.response.franchisee.FranchiseeSelectVO;
import com.hst.capacity.domain.model.response.franchisee.FranchiseeUserVO;
import com.hst.capacity.domain.model.response.franchisee.commision.FranchiseeCommisionVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingTarget;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 *  运营商模块的POJO属性转换器
 *
 * @author jin
 * */
@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface FranchiseeConvertor {
    FranchiseeConvertor INSTANCE = Mappers.getMapper(FranchiseeConvertor.class);

    /**
     * 查询运营商资料转换
     * @param franchiseeEntity
     * @return
     */
    FranchiseeSelectVO convert(FranchiseeEntity franchiseeEntity);

    @Mapping(source = "user.username", target = "username")
    @Mapping(source = "user.mobile", target = "mobile")
    @Mapping(source = "user.userStatus", target = "userStatus")
    @Mapping(source = "user.userType", target = "userType")
    @Mapping(source = "displayName", target = "realName")
    FranchiseeUserVO convert(FranchiseeUserEntity franchiseeUserEntity);

    void convert(@MappingTarget FranchiseeEntity entity, FranchiseeSaveParam param);

    FranchiseeCommisionVO covertFranCommision(FranchiseeCommisionEntity entity);
    List<FranchiseeCommisionVO> covertFranCommisionLst(List<FranchiseeCommisionEntity> list);
    FranchiseeCommisionEntity convert(FranchiseeCommisionSaveParam param);

}
